<script type='text/javascript'>
var script = new NGAScriptObject(
	'http://bbs.ngacn.cc/nuke.php?func=get_personal_info_js&uid=<?= $this->uid?>',
	'gbk', 
	function(data){
		$('info_loading').hide();
		$('info_display').show();
		$('nga_group').innerHTML = data['group'][1];
		$('nga_medal').innerHTML = NGAWriter.getMedals(data['medal']);
		$('nga_fame').innerHTML = data['fame']/10;
		$('nga_title').innerHTML = data['title']?"“"+data['title']+"”":'<span class="gray">无</span>'; 
		$('nga_posts').innerHTML = data['posts'];
		$('nga_money').innerHTML = NGAWriter.getMoney(data['money']);
		$('nga_lastpost').innerHTML = data['lastpost']?formatTime(data['lastpost']*1000):'<span class="gray">还没有发过贴</span>';
		NGAWriter.getReputations(data['reputation']);
	},
	function(){
		
	}
);
NGAScriptLoader.push(script);

var topic_counter = 0;
var script = new NGAScriptObject(
	'http://bbs.ngacn.cc/nuke.php?func=loadtopic&f=usertopic&realtime=1&uid=<?= $this->uid?>&js=1',
	'gbk', 
	function(data){
		$('subjects_loading').hide();
		var k = 0;
		var template = new Template($('template_subject').innerHTML.replace("<!--", '').replace('-->', ''));
		var template2 = new Template($('template_subject2').innerHTML.replace("<!--", '').replace('-->', ''));
		for(var i in data){
			var item = data[i];
			if(item.forum_name){
				var temp = (item.forum_name).split('-');
				item.forum_name = temp[0].trim();
			}
			if(item.tid!=0){
				$('nga_subjects').insert(template.evaluate(item));
			}else{
				$('nga_subjects').insert(template2.evaluate(item));	
			}
			k++;
			if(k>=5) break;
		}
		if(k==0) {
			topic_counter++;
			$('nga_subjects_div').hide();
		}
		if(topic_counter==2){
			handleTopicDisplay();
		}
	},
	function(){
		
	}
);
NGAScriptLoader.push(script);

var script = new NGAScriptObject(
	'http://bbs.ngacn.cc/nuke.php?func=loadtopic&f=userpost&realtime=1&uid=<?= $this->uid?>&js=1',
	'gbk', 
	function(data){
		$('replys_loading').hide();
		var k = 0;
		var template = new Template($('template_subject').innerHTML.replace("<!--", '').replace('-->', ''));
		var template2 = new Template($('template_subject2').innerHTML.replace("<!--", '').replace('-->', ''));
		for(var i in data){
			var item = data[i];
			if(item.forum_name){
				var temp = (item.forum_name).split('-');
				item.forum_name = temp[0].trim();
			}
			if(item.tid!=0){
				$('nga_replys').insert(template.evaluate(item));
			}else{
				$('nga_replys').insert(template2.evaluate(item));	
			}
			k++;
			if(k>=5) break;
		}
		if(k==0) {
			topic_counter++;
			$('nga_replys_div').hide();
		}
		if(topic_counter==2){
			handleTopicDisplay();
		}
	},
	function(){
		
	}
);
NGAScriptLoader.push(script);

var script = new NGAScriptObject(
	'http://bbs.ngacn.cc/nuke.php?func=get_personal_info_js&uid=<?= $this->uid?>&signature=1',
	'gbk', 
	function(data){
		$('nga_signature').value = data.signature;
	},
	function(){
		
	}
);
NGAScriptLoader.push(script);

function handleTopicDisplay(){
	var template = new Template($('template_notopic').innerHTML.replace("<!--", '').replace('-->', ''));
	$('nga_topic_div').innerHTML = template.evaluate({});
}

</script>